package com.hjtech.inject;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.hjtech.inject.annotation.InjectView;
import com.hjtech.inject.annotation.onClick;

public class MainActivity extends AppCompatActivity {

    @InjectView(R.id.tv_content)
    TextView tvContent;
    @InjectView(R.id.btn_1)
    Button button1;
    @InjectView(R.id.btn_2)
    Button button2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Utils.injectView(this);
        tvContent.setText("6666666666");
        Utils.injectEvent(this);
    }

    @onClick({R.id.btn_1, R.id.btn_2})
    public void Click(View view) {
        switch (view.getId()) {
            case R.id.btn_1:
                tvContent.setText("点击了按钮1");
                break;
            case R.id.btn_2:
                tvContent.setText("点击了按钮2");
                break;
            default:
                break;
        }
    }
}
